package com.learn.fragmentexample;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.Toast;

public class HeaderFragment extends Fragment {

    private ImageButton mBackBtn;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.header_fragment, container, false);
        mBackBtn = view.findViewById(R.id.header_back_btn);
        mBackBtn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v)
            {
                Toast.makeText(getActivity(), "I am an ImageButton in HeaderFragment ! ", Toast.LENGTH_SHORT).show();
            }
        });
        return view;
    }
}
